{% extends 'siteAdmin/siteAdmin.html' %}
{% block operation %}
{#% include 'siteAdmin/tinyPart.html' with context %#}
{% if req.path =='/siteAdmin/olsAdd' %}
        <div id="box">
        {% if pageData['ols'].id %}
            <form  name="testform" method="POST" action="/siteAdmin/olsAdd?update={{pageData['ols'].id}}">
                <h2>Riga Assegnata a {{pageData['ols'].user.username}}</h2>
                <h3>E-mail: {{pageData['ols'].user.email}}</h3>
                <h3>Url: {{pageData['ols'].user.url}}</h3>
                <h3>Registrato il :{{pageData['ols'].user.registration_date|dateformat}}</h3><br />
        {% else %}
            <form  name="testform" method="POST" action="/siteAdmin/olsAdd?add">
        {% endif %}
    <!-- calendar attaches to existing form element -->
                <span class="word">Codice</span><br />
                <span class="insert">
                <input name="olsCodice" type="text" value ="{{pageData['ols'].codice|nonone}}" style="width: 10%"/></span><br /><br />
                <span class="word">Spot</span><br />
                <input name="olsSpot" type="text" maxlength="220" style="width: 100%" value="{{pageData['ols'].spot|nonone|escape}}"/><br /><br />
           <br />
                <div style="height:110px;">
<span class="word">Data inserimento</span><br />
            <input type="text" name="olsDataRegistrazione" value ="{{pageData['ols'].data_registrazione|dateformat|replace('/','-')}}" />
                <script language="JavaScript">
                new tcal ({
                    // form name
                    'formname': 'testform',
                    // input name
                    'controlname': 'olsDataRegistrazione'
                });
                </script></span><br /><br />
        <span class="word">Data scadenza </span><br />
                <input type="text" name="olsDataExpire" id="myOtherInput" value ="{{pageData['ols'].data_expire|dateformat|replace('/','-')}}"/>
                <script language="JavaScript">
                    new tcal ({
                    // form name
                    'formname': 'testform',
                    // input name
                    'controlname': 'olsDataExpire'
                    });
                    </script></span><br /><br />

                <input type="submit" class="wymupdate" value="Aggiungi/modifica"/></form>
        </div>

    {% elif req.path =='/siteAdmin/olsList' %}
        <div id="box">
                <span class="testa"><h1>Gestione OLS Line</h1></span>
                <hr></hr>
                <div class="row normal">
                <a href="/siteAdmin/olsAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi una riga ols" title="aggiungi una riga ols"/>
                </a>
                </div>
                {% for page in pageData['olss'] %}
                <div class="row normal lineTop" >

                    <span >{{page.codice}} - {{page.spot|bbcode}} - {{page.data_registrazione|dateformat}}</span>
                    <span class="image"><a href="/siteAdmin/olsDel?olsId={{page.id}}" onClick='return confirm("Sei sicuro di voler cancellare questa riga ols?")' ><img src="/templates/siteAdmin/img/trash.png" alt="elimina la riga ols" title="elimina la riga ols"/></a></span>
                    <span class="image"><a href="/siteAdmin/olsAdd?edit={{page.id}}"><img src="/templates/siteAdmin/img/modifica.png" alt="modifica una riga ols" title="modifica una riga ols"/></a></span>
            {% if page.active==1 %}
            <span class="image normal" >
                <a href="/siteAdmin/olsActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_on.png" alt="disattiva riga ols" title="disattiva riga ols"/>
                </a>
            </span>
            {% endif%}
            {% if page.active==0 %}
            <span class="image normal">
                <a href="/siteAdmin/olsActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_off.png" alt="attiva riga ols" title="attiva riga ols"/>
                </a>
            </span>
            {% endif%}
                </div>
                {% endfor %}
            <ul class="pages">
                <li class="prima">Riga Ols</li>
                {% for i in range(0,pageData['item']) %}
                    {% if i != pageData['pag'] %}
                        <li><a href="/siteAdmin/olsList?pag={{i+1}}">{{i+1}}</a></li>
                    {% else %}
                        <li>[<a href="/siteAdmin/olsList?pag={{i+1}}">{{i+1}}</a>]</li>
                    {% endif %}
                {% endfor %}
            </ul>
                <div class="row normal lineTop">
                <a href="/siteAdmin/olsAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi una riga ols" title="aggiungi una riga ols"/>
                </a>
                </div>
        </div>

{% endif %}
        </div>
{%endblock%}
